﻿using DataProcessor.Process;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;

namespace DataProcessor
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            var IsDebug = false;
            if(!IsDebug)
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                new ServiceProcessor()
                };
                ServiceBase.Run(ServicesToRun);
            }
            else
            {
               // string s =
                 //   "##0352QN=20190409000933000;ST=31;CN=2011;PW=123456;MN=108302858226000270100003;Flag=5;CP=&&DataTime=20190409000933;a00000-Rtd=0.00,a00000-Flag=N;a05002-Rtd=1.20,a05002-Flag=N;a24088-Rtd=3.13,a24088-Flag=N;a24089-Rtd=4.75,a24089-Flag=N;a01014-Rtd=1.43,a01014-Flag=N;a01011-Rtd=0.00,a01011-Flag=N;a01012-Rtd=205.50,a01012-Flag=N;a01013-Rtd=0.08,a01013-Flag=N&&6480";
                string str = "##0513ST=31;CN=2031;PW=123456;MN=32062722670001;Flag=1;CP=&&DataTime=20180712000000;x10-Cou=0.02,x10-Min=0.00,x10-Avg=0.15,x10-Max=1.50;x11-Cou=0.07,x11-Min=0.00,x11-Avg=0.54,x11-Max=1.80;x12-Cou=0.07,x12-Min=0.00,x12-Avg=0.57,x12-Max=1.41;S03-Cou=0.00,S03-Min=0.00,S03-Avg=52.93,S03-Max=69.40;S08-Cou=0.00,S08-Min=-0.07,S08-Avg=-0.04,S08-Max=0.00;B02-Cou=118422.70,B02-Min=0.00,B02-Avg=2.35,B02-Max=2.84;S09-Cou=0.00,S09-Min=0.00,S09-Avg=99647.00,S09-Max=102694.00;S05-Cou=0.00,S05-Min=0.00,S05-Avg=4.00,S05-Max=4.00&&AF01";
                DataInstructionProcessor.Process2031(str);
                DataInstructionProcessor.Process2031Month(str);
                DataInstructionProcessor.Process2031Year(str);

            }
        }
    }
}
